package dk.itu.amds.auctionhouse.domain;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import dk.itu.amds.auctionhouse.data.AuctionHouseDB;


public class AuctionHouse implements Serializable {
	private Map<Integer, AuctionItem> auctionItems = new HashMap<Integer, AuctionItem>();
	private int currentAuctionItemId = 1;
	
	public Map<Integer, AuctionItem> getAuctionItems() {
		return auctionItems;
	}

	public void setAuctionItems(Map<Integer, AuctionItem> auctionItems) {
		this.auctionItems = auctionItems;
	}
	
	public void addAuctionItem(AuctionItem auctionItem) {
		auctionItem.setId(currentAuctionItemId++);
		auctionItems.put(auctionItem.getId(), auctionItem);
	}
	
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		
		sb.append("AuctionHouse list:\n");
		for(int key : auctionItems.keySet()) {
			sb.append(auctionItems.get(key) + "\n");
		}
		
		return sb.toString();
	}
	
	public static void main(String[] args) {
		AuctionHouseDB sb = new AuctionHouseDB();
		
		System.out.println(sb.getAuctionHouse());
	}
}
